<?php

namespace App\Providers;

use App\Services\ConfigService;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use App\Validators\CustomValidator;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        Auth::extend('custom', function($app) {
            $provider =  new CustomUserProvider('App\Models\User');
            return $provider;
        });

        Validator::resolver(function($translator, $data, $rules, $messages) {
            return new CustomValidator($translator, $data, $rules, $messages);
        });

        $this->app->singleton('maqu.config', function ($app) {
            return new ConfigService();
        });
    }
}
